package com.prs.crm.domain.fs;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.crm.Customer;
import com.prs.crm.domain.crm.Linkman;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.project.Project;

@Entity
@Table(name="fs_outlay")
public class Outlay extends BaseEntity{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@ManyToOne
	private BankAccount bankAccount;
	private String title;
	@ManyToOne
	private Person usePerson;
	private Date useTime;
	@ManyToOne
	private Linkman linkman;
	@ManyToOne
	private Customer customer;
	@ManyToOne
	private Project project;
	@ManyToOne(fetch = FetchType.LAZY)
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Attachment attach;
	private String state;
	@OneToMany(fetch = FetchType.LAZY,mappedBy="outlay")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Set<OutlayDetail> outlayDetails;
	private Double money;	
	private String isReturn;
	private String returnFlag;
	@OneToOne(fetch=FetchType.LAZY,mappedBy="outlay")
	private OutlayReturn outlayReturn;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public BankAccount getBankAccount() {
		return bankAccount;
	}
	public void setBankAccount(BankAccount bankAccount) {
		this.bankAccount = bankAccount;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public Person getUsePerson() {
		return usePerson;
	}
	public void setUsePerson(Person usePerson) {
		this.usePerson = usePerson;
	}
	public Date getUseTime() {
		return useTime;
	}
	public void setUseTime(Date useTime) {
		this.useTime = useTime;
	}
	public Linkman getLinkman() {
		return linkman;
	}
	public void setLinkman(Linkman linkman) {
		this.linkman = linkman;
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public Project getProject() {
		return project;
	}
	public void setProject(Project project) {
		this.project = project;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getState() {
		return state;
	}
	public void setOutlayDetails(Set<OutlayDetail> outlayDetails) {
		this.outlayDetails = outlayDetails;
	}
	public Set<OutlayDetail> getOutlayDetails() {
		return outlayDetails;
	}
	public void setMoney(Double money) {
		this.money = money;
	}
	public Double getMoney() {
		return money;
	}
	public void setIsReturn(String isReturn) {
		this.isReturn = isReturn;
	}
	public String getIsReturn() {
		return isReturn;
	}
	public void setReturnFlag(String returnFlag) {
		this.returnFlag = returnFlag;
	}
	public String getReturnFlag() {
		return returnFlag;
	}
	public void setOutlayReturn(OutlayReturn outlayReturn) {
		this.outlayReturn = outlayReturn;
	}
	public OutlayReturn getOutlayReturn() {
		return outlayReturn;
	}
	
}
